using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Iacym.Entities;

namespace Iacym.Repository.Mapping
{
    public class HISTORIAL_MINISTERIOMap : EntityTypeConfiguration<HISTORIAL_MINISTERIO>
    {
        public HISTORIAL_MINISTERIOMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("HISTORIAL_MINISTERIO");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.PersonaId).HasColumnName("PersonaId");
            this.Property(t => t.MinisterioId).HasColumnName("MinisterioId");

            // Relationships
            this.HasRequired(t => t.MINISTERIO)
                .WithMany(t => t.HISTORIAL_MINISTERIO)
                .HasForeignKey(d => d.MinisterioId);
            this.HasRequired(t => t.PERSONA)
                .WithMany(t => t.HISTORIAL_MINISTERIO)
                .HasForeignKey(d => d.PersonaId);

        }
    }
}
